/*
 * Copyright (c) 2001-2004 vTradEx Information Technology Co.,Ltd. All Rights Reserved.
 *
 * This software is the confidential and proprietary information of vTradEx
 * Information Technology Co.,Ltd. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with vTradEx.
 *
 * VTRADEX MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
 * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 * PURPOSE, OR NON-INFRINGEMENT. VTRADEX SHALL NOT BE LIABLE FOR ANY DAMAGES
 * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
 * THIS SOFTWARE OR ITS DERIVATIVES.
 */
/* $Id: admin_global.js,v 1.1 2008/06/06 11:23:20 shuming.yusm Exp $ */

function hasChecked(boxName) {
 	var selector=document.getElementsByName(boxName);
	if (!selector) {
		return false;
	}
    if(selector.length){
       	for(i=0;i<selector.length;i++){
       		if(selector[i].checked) {
       			return true;
       		}
       	}
       	return false;
   	}else{
   		return selector.checked;
   	}
}

function confirmDeletes(boxName, message) {
 	if(hasChecked(boxName)) {
 		return confirmDelete(message);
 	} else {
 		alert(noSelect);
 		return false;
 	}
}

function confirmDelete(message) {
    return confirm(message);
}

function returnDialog(result)
{
  if (isIE()) {
      window.returnValue = result;
  } else {
  window.opener.ModalDialog.value = result;
  }
  window.close();
}

function toggleVisibility(targetId) {
    if (document.getElementById) {
        target = document.getElementById(targetId);
    	if (target.style.visibility == "hidden"){
    		target.style.visibility = (document.getElementById||document.all)? "visible" : "show";
    	} else {
    		target.style.visibility = "hidden";
    	}
    }
}

function isIE() {
    return  /msie/i.test(navigator.userAgent) &&
		   !/opera/i.test(navigator.userAgent);
}

function doSelect(sysParamForm){
	var str = '';
	for( i=0 ; i<document.forms.ec.elements.length ; i++){
		if (document.forms.ec.elements[i].name=='idArray'&&document.forms.ec.elements[i].checked){
		  	str = str+ ',' +document.forms.ec.elements[i].value;
		}
	}
	if(str==''){
		return false;
	}
	sysParamForm.idArrays.value=str;
	sysParamForm.submit();
}

function doView(sysParamForm,id){
	sysParamForm.id.value=id;
	sysParamForm.method.value='view';
	sysParamForm.submit();
}

function doEdit(sysParamForm,id){
	sysParamForm.id.value=id;
	sysParamForm.method.value='edit';
	sysParamForm.submit();
}




